package com.tulele.vtool.wechat;

import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * 用户关注公众号的场景
 */
public class WeChatUserSubscribeScene {
    private static final Map<String, String> subscribeSceneMap = Maps.newHashMapWithExpectedSize(9);

    static {
        subscribeSceneMap.put("ADD_SCENE_SEARCH", "公众号搜索");
        subscribeSceneMap.put("ADD_SCENE_ACCOUNT_MIGRATION", "公众号迁移");
        subscribeSceneMap.put("ADD_SCENE_PROFILE_CARD", "名片分享");
        subscribeSceneMap.put("ADD_SCENE_QR_CODE", "扫描二维码");
        subscribeSceneMap.put("ADD_SCENE_PROFILE_LINK", "图文页内名称点击");
        subscribeSceneMap.put("ADD_SCENE_PROFILE_ITEM", "图文页右上角菜单");
        subscribeSceneMap.put("ADD_SCENE_PAID", "支付后关注");
        subscribeSceneMap.put("ADD_SCENE_WECHAT_ADVERTISEMENT", "微信广告");
        subscribeSceneMap.put("ADD_SCENE_OTHERS", "其他");
    }

    /**
     * 根据用户关注公众号的场景的代码获取文本
     * @param code
     * @return
     */
    public static String getSubscribeSceneText(String code) {
        if (StringUtils.isBlank(code)) {
            return "";
        }

        String text = subscribeSceneMap.get(code);
        if (StringUtils.isBlank(text)) {
            return "";
        }
        return text;
    }
}
